package controllers

import (
	"fmt"
	"github.com/astaxie/beego"
	. "zhhuiyan/models"
	"zhhuiyan/db"
	"zhhuiyan/models"
)

type MainController struct {
	beego.Controller
}

func (this *MainController) Set(tpl string) {
	this.Layout = "layout.html"
	this.TplNames = tpl
}
func (this *MainController) Get() {

	page := &Page{Size:20 }
	models := *new([]models.Model)
	if err := db.List("model", page, &models); err != nil {
		fmt.Println(err)
	}
	this.Data["Models"] = models
	this.Data["Page"] = page
	this.Data["Website"] = "beego.me"
	this.Data["Email"] = "astaxie@gmail.com"
	this.Data["Path"] = "model"
	this.Set("model/list.html")
}

